﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;

namespace WMI.NET.CIM
{
    /// <summary>
    /// The CIM_SerialController class represents the capabilities and management of the serial port logical device.
    /// </summary>
    public class CIM_SerialController : CIM_Controller
    {

        private UInt16[] _Capabilities;
        private string[] _CapabilityDescriptions;
        private Nullable<UInt32> _MaxBaudRate;

        /// <summary>
        ///  Chip-level compatibility for the serial controller. This property describes buffering and other capabilities of the serial controller, that may be inherent in the chip hardware. This property is an enumerated integer.
        /// </summary>
        public UInt16[] Capabilities { get { return _Capabilities; } } //TODO enum

        /// <summary>
        /// Free-form strings that provide detailed explanations for the serial controller features indicated in the Capabilities array.
        ///Note   Each entry of this array is related to the entry in the Capabilities array that is located at the same index.
        /// </summary>
        public string[] CapabilityDescriptions { get { return _CapabilityDescriptions; } }

        /// <summary>
        /// Maximum baud rate, in bits-per-second, supported by the serial controller.
        /// </summary>
        public Nullable<UInt32> MaxBaudRate { get { return _MaxBaudRate; } }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mbo"></param>
        public CIM_SerialController(ManagementBaseObject mbo)
            : base(mbo)
        {
            _Capabilities = mbo.GetUshortValueArray("Capabilities");
            _CapabilityDescriptions = mbo.GetStringValueArray("CapabilityDescriptions");
            _MaxBaudRate = mbo.GetUIntValue("MaxBaudRate");
        }

    }
}
